﻿@model HotelManageSystem.Domain.Entities.Godownentry

@{
    ViewBag.Title = "填写入库单";
    Layout = "~/Views/Shared/_LayoutWarehouse.cshtml";
}

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<div class="creatGo" style="width: 100%;height: 100%">
    @using (Html.BeginForm()) {
        @Html.ValidationSummary(true)
        <fieldset>
            <table>
                <ul>
                    <tr style="font-weight: 100">
                        <td><h3>入库单号：</h3></td>
                        <td>@Html.Raw("<input  value='" + @ViewData["godownentryID"] + "'type='text'  disabled='disabled'/>")</td>
                    </tr>
                    <tr>
                        <td><h3>货品名：</h3></td>
                        <td> @Html.DropDownList("productName","请选择货品")</td>
                        
                    </tr>
                    <tr>
                        <td><h3>提供商:</h3></td>
                        <td>@Html.DropDownList("productProvider","请选择提供商")</td>
                    </tr>
                    <tr>
                        <td><h3>入库单价:</h3></td>
                        <td>@Html.TextBox("textprice")</td>
                    </tr>
                    <tr>
                        <td><h3>入库数量:</h3></td>
                        <td>@Html.TextBox("textcount")</td>
                        <td>
                             <div id="total">
                                  @Html.TextBox("texttotal")
                              </div>
                        </td>
                    </tr>
                    <tr>
                        <td><h3>入库时间:</h3></td>
                        <td>
                            @Html.EditorFor(model => model.Datetime)
                            @Html.ValidationMessageFor(model => model.Datetime)
                        </td>
                    </tr>
                    <tr>
                        <td><h3>审核人:</h3></td>
                        <td>@Html.EditorFor(model => model.Billproducer)
                            @Html.ValidationMessageFor(model => model.Billproducer)
                        </td>
                    </tr>
                    <tr>
                        <td><h3>存放仓库:</h3></td>
                        <td> @Html.DropDownList("warehouse", "请选择仓库")</td>
                    </tr>
                    <tr>
                        <td><h3>制单人:</h3></td>
                        <td>@Html.DropDownList("employee", "审核人")</td>
                    </tr>
                    <tr>
                    <td><input id="Creatgodownventory" type="submit" value="创建" /></td>
                    <td><td> @Html.ActionLink("返回", "Index")</td></td>
                </tr>
            </ul>
            </table>

        </fieldset>
    }
    <div>
        @Html.ActionLink("Back to List", "Index")
    </div>
    
</div>

<script src="../../Scripts/jquery-1.7.1.js" type="text/javascript"></script>
<script type="text/javascript" >
    $(document).ready(function () {
        $(".field").change(function () {
            $(this).css("background-color", "#FFFFCC");
        });
        $("#textcount").keyup(function () {
            var price = $("#textprice").attr("value");
            var count = $("#textcount").attr("value");

            $("#texttotal").val(price * count);
        }
        );
        $("#textprice").keyup(function () {
            var price = $("#textprice").attr("value");
            var count = $("#textcount").attr("value");

            $("#texttotal").val(price * count);
        }
        );
        $("#total").hide();

        $('#textprice').blur(function () {
            var va = $(this).val();
            if (va == null || !/^[￥$]?\d+(.\d{1,2})?$/.test(va)) {
                window.alert('输入格式错误！');
                $(this).focus();
            }
        });
        $(":submit").click(function () {

            if ($("#textprice").attr("value") == null) {
                alert("吃出货价格不可为空");
                return false;
            }
            if ($("#textcount").attr("value") == null) {
                alert("吃出货数量时不可为空");
                return false;
            }
            return true;

        });
    });

   
</script>